/*------------------------------------------------------------------------
//                          Project CommonLib                           //
------------------------------------------------------------------------*/

#pragma once
#include "dbghelp.h"
namespace Exception 
{
	// based on dbghelp.h
	typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
			 CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
			 CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
			 CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
			 );

	class MiniDumper
	{

	public:
		MiniDumper( LPCWSTR szAppName );
		~MiniDumper();

	private:
		static LPCWSTR m_szAppName;

		static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );

		_EXCEPTION_POINTERS *ms_pPreviousExceptionFilter;
	};


}

/*------------------------------------------------------------------------

------------------------------------------------------------------------*/
